﻿<UserControl x:Class="LiveTiss.Guias.UserControls.OutrasDespesas"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:converter="clr-namespace:LiveTiss.Classes.TypeConverter"
    mc:Ignorable="d" Width="910" x:Name="ucDespesas">

    <UserControl.Resources>
        <converter:EnumConverter x:Key="enumConverter" />
    </UserControl.Resources>
    
    <Grid x:Name="Agrupamento" Margin="0,19,0,0" VerticalAlignment="Top">
        <Rectangle x:Name="Contorno" RadiusY="6" RadiusX="6" Stroke="#4D898989"/>
        <TextBlock x:Name="Titulo_Agrupamento" TextWrapping="Wrap" Text="Outras Despesas" Margin="10,10,8,0" VerticalAlignment="Top" FontFamily="Segoe UI Semibold" FontSize="16"/>
        <StackPanel x:Name="Conteudo_Agrupamento" Margin="12,44,8,0">

            <ItemsControl Name="icDespesas" ItemsSource="{Binding Path=Value.despesa, ElementName=ucDespesas, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=TwoWay}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <ContentControl>
                            <Grid Background="#FFD9F1F1" Margin="12,14,14,0" VerticalAlignment="Top">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="33"/>
                                    <RowDefinition Height="*" />
                                </Grid.RowDefinitions>
                                <Grid Margin="8,0,0,-2">
                                    <TextBlock TextWrapping="Wrap" Text="01" FontSize="16"/>
                                    <Button x:Name="btnExcluir" Content="X" HorizontalAlignment="Right" Margin="0,4,6,6" Width="25" Height="25" Style="{StaticResource Fechar_TipoGuia}" Foreground="White"
                                            Click="btnExcluir_Click"/>
                                </Grid>
                                <toolkit:WrapPanel Margin="0,2,0,10" Orientation="Horizontal" Grid.Row="1">
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Tabela"/><Run Text=":"/></TextBlock>
                                            <ComboBox Margin="0,6,0,0" SelectedValue="Key" DisplayMemberPath="Value" HorizontalAlignment="Left" 
                                                ItemsSource="{Binding identificadorDespesa.tipoTabelaItems, Mode=OneWay}"
                                                SelectedIndex="{Binding identificadorDespesa.tipoTabela,Converter={StaticResource enumConverter}, ConverterParameter='Tabela', Mode=TwoWay}"/>
                                        </StackPanel>
                                        <TextBlock TextWrapping="Wrap" Text="*" FontFamily="Segoe UI" FontWeight="Bold" FontSize="21.333" Foreground="#FF307852" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Código da Despesa"/><Run Text=":"/></TextBlock>
                                            <TextBox Text="{Binding identificadorDespesa.codigo, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" MaxLength="10" Margin="0,6,0,0"/>
                                        </StackPanel>
                                        <TextBlock TextWrapping="Wrap" Text="*" FontFamily="Segoe UI" FontWeight="Bold" FontSize="21.333" Foreground="#FF307852" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Descrição da Despesa"/><Run Text=":"/></TextBlock>
                                            <TextBox Text="{Binding identificadorDespesa.descricao, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" MaxLength="80" Margin="0,6,0,0"/>
                                        </StackPanel>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Data Realização"/><Run Text=":"/></TextBlock>
                                            <sdk:DatePicker SelectedDateFormat="Short" SelectedDate="{Binding _dataRealizacao, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" Margin="0,6,0,0"/>
                                        </StackPanel>
                                        <TextBlock TextWrapping="Wrap" Text="*" FontFamily="Segoe UI" FontWeight="Bold" FontSize="21.333" Foreground="#FF307852" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Hora de Início"/><Run Text=":"/></TextBlock>
                                            <toolkit:TimePicker Margin="0,6,0,0" Value="{Binding _horaInicial, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}"/>
                                        </StackPanel>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Hora Final"/><Run Text=":"/></TextBlock>
                                            <toolkit:TimePicker Margin="0,6,0,0" Value="{Binding _horaFinal, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}"/>
                                        </StackPanel>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Redução Acrescimo"/><Run Text=":"/></TextBlock>
                                            <TextBox Text="{Binding reducaoAcrescimo, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True}" MaxLength="80" Margin="0,6,0,0"/>
                                        </StackPanel>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Quantidade"/><Run Text=":"/></TextBlock>
                                            <TextBox Text="{Binding quantidade, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Margin="0,6,0,0"/>
                                        </StackPanel>
                                        <TextBlock TextWrapping="Wrap" Text="*" FontFamily="Segoe UI" FontWeight="Bold" FontSize="21.333" Foreground="#FF307852" Height="16" VerticalAlignment="Top" HorizontalAlignment="Left"/>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Valor Unitário"/><Run Text=":"/></TextBlock>
                                            <TextBox Margin="0,6,0,0" Text="{Binding valorUnitario,ValidatesOnDataErrors=True,NotifyOnValidationError=True,Mode=TwoWay, ValidatesOnExceptions=True}"/>
                                        </StackPanel>
                                    </Grid>
                                    <Grid Width="210" Margin="0">
                                        <StackPanel Margin="8,0,0,0" d:LayoutOverrides="GridBox">
                                            <TextBlock TextWrapping="Wrap" FontFamily="Segoe UI" FontSize="10.667"><Run Text="Total"/><Run Text=":"/></TextBlock>
                                            <TextBox Margin="0,6,0,0" Text="{Binding valorTotal,ValidatesOnDataErrors=True,NotifyOnValidationError=True, ValidatesOnExceptions=True,Mode=TwoWay}"/>
                                        </StackPanel>
                                    </Grid>
                                </toolkit:WrapPanel>
                            </Grid>
                        </ContentControl>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

            <Grid Margin="0,6,14,0" HorizontalAlignment="Right">
                <Button x:Name="btnNovo" Content="Nova Despesa" Width="121" Height="22" Click="btnNovo_Click"/>
            </Grid>

            <Grid Height="53" Margin="0,0,6,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.024*"/>
                    <ColumnDefinition Width="0.976*"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.ColumnSpan="2" Margin="0" Grid.Row="2" Grid.Column="2">
                    <TextBlock TextWrapping="Wrap" Text="Valor Total de Outras Despesas:" FontFamily="Segoe UI" FontSize="13.333"/>
                    <TextBox Margin="0,6,323,0" Text="{Binding Value.totalGeralOutrasDespesas, ElementName=ucDespesas, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" />
                </StackPanel>
            </Grid>
        </StackPanel>
    </Grid>
</UserControl>
